import request from '@/utils/request'

export function listWork(projectId, query) {
  return request({
    url: '/user/project/work/list/' + projectId,
    method: 'get',
    params: query
  })
}

export function listAllWork(projectId, query) {
  return request({
    url: '/user/project/work/listAll/' + projectId,
    method: 'get',
    params: query
  })
}

export function listMyAllWork(query) {
  return request({
    url: '/user/project/work/listMyAll',
    method: 'get',
    params: query
  })
}

export function listWorkNeed(projectId, query) {
  return request({
    url: '/user/project/work/listNeed/' + projectId,
    method: 'get',
    params: query
  })
}

export function getWorkBySprintId(sprintId) {
  return request({
    url: '/user/project/work/getWorkBySprintId/' + sprintId,
    method: 'get',
  })
}

export function getWorkByNoSprintId(projectId) {
  return request({
    url: '/user/project/work/getWorkByNoSprintId/' + projectId,
    method: 'get',
  })
}


export function getWorkById(workId) {
  return request({
    url: '/user/project/work/getWorkById/' + workId,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/user/project/work',
    method: 'post',
    data
  })
}

export function workAddSprintByIds(sprintId, data) {
  return request({
    url: '/user/project/work/workAddSprintByIds/' + sprintId,
    method: 'post',
    data
  })
}

export function workRemoveSprintByIds(sprintId, data) {
  return request({
    url: '/user/project/work/workRemoveSprintByIds/' + sprintId,
    method: 'post',
    data
  })
}

export function updateWork(data) {
  return request({
    url: '/user/project/work',
    method: 'put',
    data: data
  })
}

// 删除工作项
export function delWork(workItemId) {
  return request({
    url: '/user/project/work/' + workItemId,
    method: 'delete'
  })
}
// 获取工作项详细信息
export function getWorkAllInit(workItemId) {
  return request({
    url: '/user/project/work/workAllInit/' + workItemId,
    method: 'get'
  })
}
